flag = false;

function explore()
    local x = ocrText(83, 22, 208, 36, 1)
    dialog(x)
    -- dialog("搜索功能不好使")
end

function call_elves(backblue)
    
    if backblue == "186" then
        if
            multiColor({{143, 25, 0x009bdf}, {143, 32, 0x009bdf}}, 90, false) == true and
                multiColor({{207, 25, 0x009bdf}, {207, 32, 0x009bdf}}, 90, false) == true
         then
            flag = true;
            mSleep(1000)
            call1()
            mSleep(1000)
            call2()
            for var = 1, 6 do
                move_client_up()
                mSleep(1000)
            end
            mSleep(1000)
            call1()
            mSleep(1000)
            call2()
            mSleep(1000)
            for var = 1, 6 do
                move_client_down()
                mSleep(1000)
            end
        elseif
            multiColor({{143, 25, 0x009bdf}, {143, 32, 0x009bdf}}, 90, false) == true and
                multiColor({{207, 25, 0x009bdf}, {207, 32, 0x009bdf}}, 90, false) == false and flag == true
         then
            mSleep(1000)
            call1()
            mSleep(1000)
            call2()
            for var = 1, 6 do
                move_client_up()
                mSleep(1000)
            end
            mSleep(1000)
            call1()
            mSleep(1000)
            call2()
            mSleep(1000)
            for var = 1, 6 do
                move_client_down()
                mSleep(1000)
            end
        else
            flag = false;
            for var = 1, 6 do
                move_client_up()
                mSleep(1000)
            end
            for var = 1, 6 do
                move_client_down()
                mSleep(1000)
            end
        end
    elseif backblue == "35" then
        if
            multiColor({{91, 25, 0x009bdf}, {91, 32, 0x009bdf}}, 90, false) == true and
                multiColor({{207, 25, 0x009bdf}, {207, 32, 0x009bdf}}, 90, false) == true
         then
            flag = true;
            mSleep(1000)
            call1()
            mSleep(1000)
            call2()
            for var = 1, 6 do
                move_client_up()
                mSleep(1000)
            end
            mSleep(1000)
            call1()
            mSleep(1000)
            call2()
            mSleep(1000)
            for var = 1, 6 do
                move_client_down()
                mSleep(1000)
            end
        elseif
            multiColor({{91, 25, 0x009bdf}, {91, 32, 0x009bdf}}, 90, false) == true and
                multiColor({{207, 25, 0x009bdf}, {207, 32, 0x009bdf}}, 90, false) == false and flag == true
         then
            mSleep(1000)
            call1()
            mSleep(1000)
            call2()
            for var = 1, 6 do
                move_client_up()
                mSleep(1000)
            end
            mSleep(1000)
            call1()
            mSleep(1000)
            call2()
            mSleep(1000)
            for var = 1, 6 do
                move_client_down()
                mSleep(1000)
            end
        else
            flag = false;
            for var = 1, 6 do
                move_client_up()
                mSleep(1000)
            end
            for var = 1, 6 do
                move_client_down()
                mSleep(1000)
            end
        end
    end
    -- luaExit()
end

function magic()
    dialog("魔法练级不好使")
end

function move_client_up()
    --在坐标按下
    touchDown(144, 506)
    mSleep(30)
    --在坐标 抬起
    touchUp(144, 506)
end

function move_client_down()
    touchDown(144, 655)
    mSleep(30)
    touchUp(144, 655)
end

function call1()
    --在坐标按下
    touchDown(1018, 674)
    mSleep(30)
    --在坐标 抬起
    touchUp(1018, 674)
end

function call2()
    touchDown(1024, 610)
    mSleep(30)
    touchUp(1024, 610)
end
